agentmux_srv\backend\utilfn/
mod.rs

1// Copyright 2025-2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Utility functions ported from Go's `pkg/util/utilfn/utilfn.go`.
5//!
6//! Includes null encoding/decoding, hashing, binary detection, star matching,
7//! slice operations, string helpers, and atomic file operations.
8
9pub mod hash;
10pub mod nullenc;
11pub mod strutil;
12#[cfg(test)]
13mod tests;
14
15// ---- Re-exports ----
16
17#[allow(unused_imports)]
18pub use hash::{quick_hash_string, sha1_hash};
19#[allow(unused_imports)]
20pub use nullenc::{
21    decode_string_array, decode_string_map, encode_string_array, encode_string_map,
22    encoded_string_array_get_first_val, encoded_string_array_has_first_val, null_decode_str,
23    null_encode_str,
24};
25#[allow(unused_imports)]
26pub use strutil::{
27    add_elem_uniq, atomic_rename_copy, atoi_no_err, combine_str_arrays, ellipsis_str,
28    filter_valid_arch, get_first_line, get_line_col_from_offset, has_binary_data, indent_string,
29    is_binary_content, longest_prefix, move_to_front, random_hex_string, remove_elem,
30    shell_hex_escape, slice_idx, star_match_string, truncate_string, write_file_if_different,
31    StrWithPos, NO_STR_POS,
32};